﻿<!--*********************************************************************

   Extended WPF Toolkit

   Copyright (C) 2010-2012 Xceed Software Inc.

   This program is provided to you under the terms of the Microsoft Reciprocal
   License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license 

   This program can be provided to you by Xceed Software Inc. under a
   proprietary commercial license agreement for use in non-Open Source
   projects. The commercial version of Extended WPF Toolkit also includes
   priority technical support, commercial updates, and many additional 
   useful WPF controls if you license Xceed Business Suite for WPF.

   Visit http://xceed.com and follow @datagrid on Twitter.

  ********************************************************************-->
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Samples.Infrastructure.Controls"
    xmlns:infConverters="clr-namespace:Samples.Infrastructure.Converters">

   <infConverters:XamlColorConverter x:Key="XamlColorConverter" />
   <infConverters:CSharpColorConverter x:Key="CSharpColorConverter" />

   <LinearGradientBrush x:Key="TabBackgroundDefault" EndPoint="0.330810546875,1" StartPoint="0.330810546875,0">
      <GradientStop Color="#FF100311" Offset="1"/>
      <GradientStop Color="#FF666666" Offset="0"/>
   </LinearGradientBrush>

   <Style x:Key="TabItemStyle" TargetType="{x:Type TabItem}">
      <Setter Property="Template">
         <Setter.Value>
            <ControlTemplate TargetType="{x:Type TabItem}">
               <Grid Width="Auto" Height="29" Margin="0">
                  <Grid.RowDefinitions>
                     <RowDefinition Height="0.565*" />
                     <RowDefinition Height="0.435*" />
                  </Grid.RowDefinitions>
                  <Border Grid.RowSpan="2" CornerRadius="0" Margin="0,0,0,1" Opacity="1" SnapsToDevicePixels="True">
                     <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                           <GradientStop Color="#FF333333" Offset="0" />
                           <GradientStop Color="#FF9F9F9F" Offset="1" />
                        </LinearGradientBrush>
                     </Border.Background>
                  </Border>
                  <Border Background="{StaticResource TabBackgroundDefault}" CornerRadius="0" Margin="1,0,0,1" Grid.RowSpan="2" x:Name="border" SnapsToDevicePixels="True" />
                  <TextBlock HorizontalAlignment="Center" Margin="15,0,15,0" VerticalAlignment="Center" Grid.RowSpan="2" FontFamily="Segoe UI" FontSize="11" FontWeight="Bold" Foreground="#4CFFFFFF" Text="{TemplateBinding Header}" TextWrapping="Wrap" x:Name="textBlock" />
                  <Rectangle x:Name="rectangle" Grid.RowSpan="2" Height="1" VerticalAlignment="Top" Margin="1,1,0,0" Visibility="Collapsed" SnapsToDevicePixels="True">
                     <Rectangle.Fill>
                        <LinearGradientBrush EndPoint="0.966,0.5" StartPoint="0.045,0.479">
                           <GradientStop Color="#FFF8EDED" Offset="0.504" />
                           <GradientStop Color="#00111010" Offset="1" />
                           <GradientStop Color="#00000000" />
                        </LinearGradientBrush>
                     </Rectangle.Fill>
                  </Rectangle>
                  <Rectangle Grid.RowSpan="2" Width="1" HorizontalAlignment="Right" Margin="0,0,-1,1" SnapsToDevicePixels="True">
                     <Rectangle.Fill>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                           <GradientStop Color="#FF2B2B2B" Offset="0" />
                           <GradientStop Color="#99FFFFFF" Offset="1" />
                        </LinearGradientBrush>
                     </Rectangle.Fill>
                  </Rectangle>
               </Grid>
               <ControlTemplate.Triggers>
                  <Trigger Property="IsMouseOver" Value="True">
                     <Setter Property="Foreground" TargetName="textBlock" Value="#FFF2EDF4" />
                  </Trigger>
                  <Trigger Property="IsSelected" Value="True">
                     <Setter Property="Panel.ZIndex" Value="100" />
                     <Setter Property="Background" TargetName="border">
                        <Setter.Value>
                           <LinearGradientBrush EndPoint="-0.003,1.107" StartPoint="0,0">
                              <GradientStop Color="Navy" Offset="0" />
                              <GradientStop Color="Black" Offset="1" />
                           </LinearGradientBrush>
                        </Setter.Value>
                     </Setter>
                     <Setter Property="Foreground" TargetName="textBlock" Value="#FFFFFFFF" />
                     <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
                     <Setter Property="Fill" TargetName="rectangle">
                        <Setter.Value>
                           <LinearGradientBrush EndPoint="0.966,0.5" StartPoint="0.045,0.479">
                              <GradientStop Color="#FFF8EDED" Offset="0.504" />
                              <GradientStop Color="#00BD2FD5" Offset="1" />
                              <GradientStop Color="#00BD2FD5" />
                           </LinearGradientBrush>
                        </Setter.Value>
                     </Setter>
                     <Setter Property="Margin" TargetName="border" Value="1,0,0,0" />
                  </Trigger>
               </ControlTemplate.Triggers>
            </ControlTemplate>
         </Setter.Value>
      </Setter>
      <Setter Property="Margin" Value="0,0,1,0" />
   </Style>

   <Style x:Key="TabControlStyle" TargetType="{x:Type TabControl}">
      <Setter Property="Template">
         <Setter.Value>
            <ControlTemplate TargetType="{x:Type TabControl}">
               <Grid KeyboardNavigation.TabNavigation="Local">
                  <Grid.RowDefinitions>
                     <RowDefinition Height="Auto" />
                     <RowDefinition Height="*" />
                  </Grid.RowDefinitions>
                  <TabPanel Grid.Row="0" Margin="0,0,7,-1" x:Name="HeaderPanel" Background="Transparent" IsItemsHost="True" Panel.ZIndex="1" KeyboardNavigation.TabIndex="1" HorizontalAlignment="Right" />
                  <Border Grid.Row="1" x:Name="Border" Background="White" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="0" KeyboardNavigation.DirectionalNavigation="Contained" KeyboardNavigation.TabNavigation="Local" KeyboardNavigation.TabIndex="2" SnapsToDevicePixels="True">
                     <ContentPresenter Margin="4" x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" />
                  </Border>
                  <Rectangle HorizontalAlignment="Stretch" Margin="1,1,1,0" VerticalAlignment="Top" Width="Auto" Height="8" Grid.Row="1" SnapsToDevicePixels="True">
                     <Rectangle.Fill>
                        <LinearGradientBrush EndPoint="0.5,0.861" StartPoint="0.5,0">
                           <GradientStop Color="#FF13011B" Offset="0.014" />
                           <GradientStop Color="DarkBlue" Offset="0.97" />
                        </LinearGradientBrush>
                     </Rectangle.Fill>
                  </Rectangle>
               </Grid>
            </ControlTemplate>
         </Setter.Value>
      </Setter>
   </Style>

   <Style TargetType="{x:Type local:DemoView}">
      <Setter Property="Template">
         <Setter.Value>
            <ControlTemplate TargetType="{x:Type local:DemoView}">
               <Border Background="{TemplateBinding Background}"
                       BorderBrush="{TemplateBinding BorderBrush}"
                       BorderThickness="{TemplateBinding BorderThickness}">
                  <Grid>
                     <TabControl TabStripPlacement="Top" Style="{StaticResource TabControlStyle}" >
                        <TabItem Header="Sample" Style="{StaticResource TabItemStyle}">
                           <ScrollViewer VerticalScrollBarVisibility="Auto">
                              <ContentPresenter Margin="10" ScrollViewer.CanContentScroll="True" />
                           </ScrollViewer>
                        </TabItem>
                        <TabItem Header="XAML" Style="{StaticResource TabItemStyle}">
                           <ContentPresenter x:Name="_xamlCode" 
                                             Content="{Binding XamlText, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource XamlColorConverter}}"
                                             HorizontalAlignment="Stretch"
                                             VerticalAlignment="Stretch"
                                             ScrollViewer.CanContentScroll="True" 
                                             Margin="5,10,5,5" />
                        </TabItem>
                        <TabItem Header="Code" Style="{StaticResource TabItemStyle}">
                           <ContentPresenter x:Name="_cSharpCode" 
                                             Content="{Binding CSharpText, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource CSharpColorConverter}}"
                                             HorizontalAlignment="Stretch"
                                             VerticalAlignment="Stretch"
                                             ScrollViewer.CanContentScroll="True"
                                             Margin="5,10,5,5" />
                        </TabItem>
                     </TabControl>
                     <TextBlock Opacity="1" 
                                HorizontalAlignment="Left" 
                                Margin="12,5,0,0" 
                                VerticalAlignment="Top"
                                TextWrapping="Wrap" 
                                FontSize="18" 
                                FontFamily="Segoe UI" 
                                TextAlignment="right" 
                                Foreground="#FFFFFFFF" 
                                FontWeight="Bold" 
                                Text="{TemplateBinding Title}" />
                  </Grid>
               </Border>
            </ControlTemplate>
         </Setter.Value>
      </Setter>
   </Style>
</ResourceDictionary>
